package xin.marcher.wind.process.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository;
import xin.marcher.framework.mybatis.dao.BaseDAO;
import xin.marcher.wind.process.domain.entity.ProcessNodeLinkedDO;
import xin.marcher.wind.process.mapper.ProcessNodeLinkedMapper;

import java.util.List;

/**
 * <p>
 * 流程节点表 DAO
 * </p>
 *
 * 
 */
@Repository
public class ProcessNodeLinkedDAO extends BaseDAO<ProcessNodeLinkedMapper, ProcessNodeLinkedDO> {

    public void deleteByProcessConfigName(String processConfigName) {
        if (StringUtils.isEmpty(processConfigName)) {
            return;
        }
        LambdaQueryWrapper<ProcessNodeLinkedDO> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(ProcessNodeLinkedDO::getProcessConfigName, processConfigName);

        remove(queryWrapper);
    }

    public List<ProcessNodeLinkedDO> listByProcessConfigName(String processConfigName) {
        LambdaQueryWrapper<ProcessNodeLinkedDO> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(ProcessNodeLinkedDO::getProcessConfigName, processConfigName);
        return list(queryWrapper);
    }
}
